package com.example.myapplication;

import android.app.Application;

import android.content.Context;

import com.example.myapplication.bean.Merchant;
import com.example.myapplication.bean.User;
import com.example.myapplication.database.GreenDaoManager;
import com.kongzue.dialogx.DialogX;


import org.xutils.DbManager;
import org.xutils.x;

public class App extends Application {
private  static  App singstance;
public User user=null;
public Merchant merchant=null;
private  static  Context context;
public  static  DbManager dbManager;
   static  DbManager.DaoConfig daoConfig=new DbManager.DaoConfig()
           .setDbVersion(1)
           .setDbUpgradeListener(new DbManager.DbUpgradeListener() {
               @Override
               public void onUpgrade(DbManager db, int oldVersion, int newVersion) {

               }
           });
   public  static  Context getContext(){
       return  context;
   }
   public static  App getInstance(){
       return singstance;
   }
    @Override
    public  void onCreate(){
       super.onCreate();
       singstance=this;
       context=this.getApplicationContext();
       x.Ext.init(this);
       if (dbManager==null){
           dbManager=x.getDb(daoConfig);
       }
       GreenDaoManager.getmInstance();
        DialogX.init(this);
    }
}
